<?php

namespace app\common\library;

use think\Response;

class YuResult
{
    const VERSION = '6.0.5';

    protected $errorString = '';

    protected $status;

    protected $code;

    protected $msg;

    protected $data;

    public static $instance ;

    /**
     * @title 单例调用
     * @description 单例调用
     * @author Admin ldy
     * @time 2018/9/25  12:22
     */
    public static function getInstance(){
        if (YuResult::$instance == null){
            YuResult::$instance = new \app\common\library\YuResult;
            return YuResult::$instance;
        }else{
            return YuResult::$instance;
        }
    }

    public function __construct($msg='',$data=null,$code=0,$status=1){
        //初始化
        //1成功0失败
        $this->status = $status;
        $this->msg = $msg;
        $this->data = $data;
        $this->code = $code;
    }

    /**
     * @param int $code
     */
    public function setCode($code)
    {
        $this->code = $code;
    }

    /**
     * @param null $data
     */
    public function setData($data)
    {
        $this->data = $data;
    }

    /**
     * @param string $msg
     */
    public function setMsg($msg)
    {
        $this->msg = $msg;
    }

    /**
     * @param int $status
     */
    public function setStatus($status)
    {
        $this->status = $status;
    }

    /**
     * @return int
     */
    public function getCode()
    {
        return $this->code;
    }

    /**
     * @return string
     */
    public function getMsg()
    {
        return $this->msg;
    }

    /**
     * @return null
     */
    public function getData()
    {
        return $this->data;
    }

    /**
     * @return int
     */
    public function getStatus()
    {
        return $this->status;
    }

    public function setErrorString($msg){
        $this->errorString = $msg;
    }

    public function getErrorString(){
        return $this->errorString;
    }





}
